<template>
  <div id="shoporder">  

     <div  style="display:flex;align-items: center;">
            <img class="top_img" src="@/assets/images/a8.png" style="width:35px;height:35px;margin-right:10px;"/>
            <div style="line-height: 40px;font-weight:bold:">商品订单</div>
    </div> 

   <el-form ref="form" :model="form" label-width="70px"> 

      <div style="display:flex;">
          <div style="flex:1;display:flex;align-items: center;">

            <div style="width:50px;text-align-last: justify;margin-top:-12px;font-size: 14px;color: #606266;margin-right:10px;">查询项</div>
             <el-form-item label="用户账号" >
              <el-input v-model="form.phone" placeholder="用户账号"  style="width:140px;"></el-input>
            </el-form-item>

            <div class="buttoon_box">
                <div class="buttoon_box_item"  style="margin-left:5px;background:#FFC600;color:white;" @click="search_but1()">确 定</div>
                <div class="buttoon_box_item" style="margin-left:5px;border:1px solid #D9D9D9;" @click="sx_but()">清 空</div>    
            </div>

         </div>

     </div>
     <div style="display:flex;align-items: center;">
            <div style="width:50px;text-align-last: justify;margin-top:-12px;font-size: 14px;color: #606266;margin-right:10px;">筛选项</div> 

             <el-form-item  label="订单状态">
                <el-select  v-model="form.select1_num" placeholder="订单状态" style="width:140px;">
                    <el-option  v-for="(item,index) in select1_data" :key="index" :label="item.name" :value="item.id"></el-option>
                </el-select>
            </el-form-item>
            <div class="buttoon_box">
                <div class="buttoon_box_item"  style="margin-left:5px;background:#FFC600;color:white;" @click="search_but2()">确 定</div>
                <div class="buttoon_box_item" style="margin-left:5px;border:1px solid #D9D9D9;" @click="sx_but()">清 空</div>    
            </div>
     </div>


  
   </el-form>

   <!-- 渲染数据list -->
   <shoporder-list :datalist="datalist"  @up_list_fun="list_fun"> </shoporder-list>


      

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>


      
  </div>
</template>

<script>



import ShoporderList from '@/view/Shop/ShoporderList'
export default {
  name: 'shoporder',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,
        form:{
          phone:'',
          select1_num:''
        },
        select1_data:[{"id":1,"name":"待发货"},{"id":2,"name":"已发货"},{"id":3,"name":"已收货"}],
    }
  },
 components:{
    ShoporderList
  },
  created(){
     this.list_fun()
  },
  mounted (){
    
  },
  methods: {
    list_fun(){
        this.post("/product_order/listOfData", {
              page:this.page,
              account:this.form.phone,
              status:this.form.select1_num,
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list          
            console.log( this.datalist,"asda")
         })
    },
    search_but1(){
        this.page = 1
        this.list_fun()
    },
    sx_but(){
        this.form={
          phone:'',
        },
        this.page = 1
        this.list_fun()
    },
    
     handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      },
  }
}
</script>


<style scoped>
.buttoon_box{
  display:flex;margin-bottom:10px;
}
.buttoon_box_item{
  height:40px;line-height:40px;width:60px;font-size:14px;text-align:center;border-radius:5px;
}
.el-input-box>>>input{
  padding: 0px 3px !important;
}
</style>
